const jwt = require('jsonwebtoken')

// 生成令牌

const generateToken =  function (uid, scope) {
    const secretKey = global.config.secrurity.secretKey;
    const expiresIn = global.config.secrurity.expiresIn;
    const token = jwt.sign({
        uid,
        scope
    }, secretKey, {
        expiresIn: expiresIn
    })
    return token
}

module.exports = {
    generateToken
}